Telegram Group & Telegram Channel
Шаблоны строк для форматирования

Класс Template из пакета string в стандартной библиотеке позволяет вполне удобно создавать шаблоны строк для дальнейшего форматирования.

Такой способ появился ещё в Python 2.4, как замена %-форматированию, но популярным так и не стал. Он поддерживает передачу значений по имени и использует $-синтаксис как в PHP.

В новых проектах, конечно, используются чаще всего f-строки и иногда метод format, но всё же о Template стоит хотя бы знать на случай, если придется работать с легаси кодом.

#строки



tg-me.com/python_academy/647
Create:
Last Update:

Шаблоны строк для форматирования

Класс Template из пакета string в стандартной библиотеке позволяет вполне удобно создавать шаблоны строк для дальнейшего форматирования.

Такой способ появился ещё в Python 2.4, как замена %-форматированию, но популярным так и не стал. Он поддерживает передачу значений по имени и использует $-синтаксис как в PHP.

В новых проектах, конечно, используются чаще всего f-строки и иногда метод format, но всё же о Template стоит хотя бы знать на случай, если придется работать с легаси кодом.

#строки

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/647

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.Python Academy from nl


Telegram Python Academy
FROM USA